#! /bin/bash
#
# Setup slave chip source code env for developer
#

SRC_DIR_TO_CP="\
    scripts inc \
    comp/video comp/audio comp/module/devlib comp/pciv"

back_up_dir=${SLAVE_CHIP_DIR}/`date +%Y-%m-%d_%H.%M.%S`

# Since most developer use svn under windows
# So the only choice is copy 
#1 folder name to copy
copy_source_to_slave_env()
{
    dir_from=${TOP_DIR}/$1
    dir_to=${SLAVE_CHIP_DIR}/${1}

    echo "========================================"
    printf "%-20s --> %-30s\n" ${dir_from} ${dir_to}
    if [[ -d ${dir_to} ]]
    then
        mkdir -p ${back_up_dir}
        echo "${dir_to} Exist, back up to ${back_up_dir}"
        mv ${dir_to} ${back_up_dir}
    fi

    if [[ -d ${dir_from} ]];
    then
        cp -fR ${dir_from} `dirname ${dir_to}`
    else
        echo "${dir_from} not exist, ignored"
    fi
}

for dir in ${SRC_DIR_TO_CP};
do
	copy_source_to_slave_env ${dir}
done
echo "========================================"

# vim:et:sw=4:ts=4
